home *** CD-ROM | disk | FTP | other *** search
/ Compton's Reference Collection / Compton's Reference Collection.iso / install / crc.mst < prev    next >
Text File  |  1995-05-25  |  35KB  |  1,204 lines

  1. '*******************************************************************
  2. '*
  3. '*    DESCRIPTION: Reference Collection 1996 Installation Script
  4. '*
  5. '*******************************************************************
  6. '**************************************************************************
  7. '*   Compton's Reference Collection 1996 AND Database files AND Video For Windows 1.1
  8. '**************************************************************************
  9. '$DEFINE DEBUG  ''Define for script development/debugging
  10. '$INCLUDE 'setupapi.inc'
  11. '$INCLUDE 'msdetect.inc'
  12.  
  13.  
  14. ''Dialog ID's
  15. CONST WELCOME       =  100
  16. CONST ASKQUIT       =  200
  17. CONST ASKQUITNOTHING=  201
  18. CONST ASKQUITNOPROD =  202
  19. CONST ASKEXISTSDIR  =  210
  20. CONST ASKEXISTSPROD =  220
  21. CONST ASKEXISTSWIN  =  230
  22. CONST DESTPATH      =  300
  23. CONST EXITFAILURE   =  400
  24. CONST EXITQUIT      =  600
  25. CONST EXITSUCCESSPROD   =  700
  26. CONST EXITSUCCESSVFW=  701
  27. CONST EXITSUCCESSNMS=  702
  28. CONST PRODHELP      =  900
  29. CONST SIGNBOARD1    = 2001
  30. CONST SIGNBOARD2    = 2002
  31. CONST SIGNBOARD3    = 2003
  32. CONST SIGNBOARD4    = 2004
  33. CONST SIGNBOARD5    = 2005
  34. CONST SIGNBOARD6    = 2006
  35. CONST CUSTINST      = 6200
  36. CONST TOOBIG        = 6300
  37. CONST BADPATH       = 6400
  38. CONST MINREQUIRED   = 6500
  39. CONST RESTART       = 7900
  40. CONST RESTARTII     = 8000
  41. CONST INSTALLVFW      = 9000
  42.  
  43.  
  44.  
  45. ''Bitmap IDs
  46. CONST IDC_BM0       = 600
  47. CONST IDC_BM1       = 601
  48. ''Icon IDs
  49. CONST IDC_ICON6                 =       506
  50. CONST IDC_ICON7                 =       507
  51.  
  52.  
  53. ''File Types
  54. CONST PROD    = 1
  55. CONST VID     = 2
  56. CONST NMS     = 3
  57.  
  58. '' actual amount plus 10%
  59. CONST PRODCOST = 10316724
  60. CONST VIDCOST  = 2329118
  61. CONST NMSCOST  = 11354112
  62.  
  63. CONST DISPLAYPATHLEN = 40 '' Length limit for display of path in Custom Installation
  64.  
  65. GLOBAL CUIDLL$
  66.  
  67. GLOBAL szSaveProdDir$
  68. GLOBAL SrcDir$
  69.  
  70. GLOBAL WinDir$
  71. GLOBAL WinSysDir$
  72.  
  73. GLOBAL DEST$        '' Default destination directory.
  74. GLOBAL WINDRIVE$    '' Windows drive letter.
  75.  
  76. GLOBAL szFound$                 '' found filespec
  77.  
  78. ''CustInst list symbol names
  79. GLOBAL PRODFILES$
  80. GLOBAL VIDFILES$
  81. GLOBAL NMSFILES$
  82.  
  83. '' already installed booleans
  84. GLOBAL bProdInstalled%
  85. GLOBAL bVfwInstalled%
  86. GLOBAL bNmsInstalled%
  87.  
  88. GLOBAL cost&
  89. GLOBAL cost1&
  90. GLOBAL free&
  91. GLOBAL free1&
  92.  
  93. GLOBAL CursorSave%
  94.  
  95.  
  96. ''Dialog list symbol names
  97. GLOBAL CHECKSTATES$
  98. GLOBAL STATUSTEXT$
  99. GLOBAL DRIVETEXT$
  100. GLOBAL REQUIREDTEXT$
  101. GLOBAL HDLIST$
  102. GLOBAL INSTALLTEXT$
  103.  
  104. '' defined functions
  105. DECLARE SUB AddOptFilesToCopyList (ftype%)
  106. DECLARE SUB RecalcOptFiles (ftype%)
  107. DECLARE SUB RecalcPath
  108. DECLARE SUB SetDriveStatus
  109. DECLARE FUNCTION MakePath(szDir$, szFile$) AS STRING
  110. DECLARE SUB CheckForPROD(szPRODDir$)
  111. Declare Function TruncateToLengthOrLess(szSrcStr$, nLength%) As String
  112. Declare Function GetProcessor() As Integer
  113. Declare Function MeetsMinRequired() As Integer
  114. Declare Function RemoveSlash (szDir$) As String
  115. Declare Function MakeDirPath (szDir$) As String
  116. Declare Function IsDriverInstalled(szFile$) As String
  117. Declare Sub CheckVfWOverwrite
  118. Declare Sub    AskQuitSub
  119. Declare Sub ModifyIniVFW
  120. Declare Sub ModifyIniAnimation
  121. Declare Sub InstallProdGroup
  122.  
  123. '' external procedures
  124. Declare Function MaximizeWindow LIB "dlgprocs.dll" (hwnd%) As Integer
  125. Declare Function DoMemManInfo LIB "dlgprocs.dll" (item%) As Integer
  126. Declare Function SetTo256Min LIB "dlgprocs.dll" () As Integer
  127. Declare Function GetVerInfo LIB "dlgprocs.dll" (szPath$, szVer$, Product%) As Integer
  128. Declare Function DoVFWIniFiles LIB "dlgprocs.dll" () As Integer
  129.  
  130.  
  131. DECLARE FUNCTION GetModuleHandle LIB "kernel" (szModName$) AS INTEGER
  132. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  133. DECLARE FUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  134. ''Declare Function sndPlaySound Lib "MMSystem" (lpsound As Any, flag As Integer) As Integer
  135. Declare Function waveOutGetNumDevs Lib "MMSystem" () As Integer
  136. ''Declare Function GetDC Lib "User" (hWnd%) As Integer
  137. ''Declare Function GetDeskTopWindow Lib "User" () As Integer
  138. ''Declare Function GetDeviceCaps Lib "GDI" (hDC%, nIndex%) As Integer
  139. DECLARE FUNCTION GetPrivateProfileString LIB "Kernel" (lpApplicationName As String, lpKeyName As String, lpDefault As String, lpReturnedString As String, nSize As Integer, lpFileName As String) As Integer
  140. Declare Function GlobalCompact Lib "kernel" (flag&) As Long
  141. Declare Function GetFreeSpace Lib "kernel" (flag%) As Long
  142. Declare Function GetFreeSystemResources Lib "User" (fuSysResource As Integer) As Integer
  143. ''Declare Function ReleaseDC Lib "User" (hWnd As Integer, hDC As Integer) As Integer
  144.  
  145. Const SM_MOUSEPRESENT = 19
  146.  
  147.  
  148. INIT:
  149.     szSaveProdDir$      = ""
  150.  
  151.   ''Disk cost list symbols
  152.   PRODFILES$   = "Product"
  153.   VIDFILES$    = "VfW Runtime"
  154.   NMSFILES$    = "NMS Files"
  155.  
  156.   CUIDLL$ = "dlgprocs.dll"            '' custom user interface dll
  157.   HELPPROC$ = "FHelpDlgProc"          '' Help dialog procedure
  158.  
  159.   hwnd% = HwndFrame()
  160.   i% = MaximizeWindow(hwnd%)              '' maximize the main window
  161.  
  162.   SetBitmap CUIDLL$, IDC_BM0 '' comptons logo
  163.   SetTitle "Compton's Reference Collection 1996"
  164.  
  165.   szTmp$ = GetSymbolValue("STF_SRCINFPATH")
  166.   szInf$ = GetSymbolValue("STF_SRCINFPATH")
  167.   IF szInf$ = "" THEN
  168.     szInf$ = GetSymbolValue("STF_CWDDIR") + "CRC" + ".INF"
  169.   END IF                                    
  170.   ReadInfFile szInf$
  171.  
  172.   SrcDir$ = GetSymbolValue("STF_SRCDIR")
  173.  
  174.   WinDir$     = GetWindowsDir()
  175.   WinSysDir$  = GetWindowsSysDir()
  176.  
  177.   '' set same drive windows is on as default
  178.   WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  179.   DEST$ = WINDRIVE$ + ":\" + "CRC96"
  180.  
  181.   '' see if CRC is running
  182.   IF GetModuleHandle("CRC96") > 0 THEN
  183.      i% = DoMsgBox("Compton's is currently running."+chr$(13)+"Please exit the program and rerun Setup.","Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  184.         END
  185.   END IF
  186.  
  187.   ''CustInst list symbols
  188.   CHECKSTATES$ = "CheckItemsState"
  189.   STATUSTEXT$  = "StatusItemsText"
  190.   DRIVETEXT$   = "DriveStatusText"
  191.     REQUIREDTEXT$ = "MinRequiredText"
  192.     HDLIST$       = "HdList"
  193.     INSTALLTEXT$  = "InstallItemsText"
  194.  
  195.   '' for each section of inf file
  196.   FOR i% = 1 TO 3 STEP 1
  197.     AddListItem STATUSTEXT$, ""
  198.     AddListItem CHECKSTATES$, "ON"
  199.         AddListItem INSTALLTEXT$, "(Required)"
  200.   NEXT i%
  201.     ReplaceListItem INSTALLTEXT$, 3, "(Speed Enhancement)"
  202.     
  203.   '' for the display in custinst
  204.   FOR i% = 1 TO 7 STEP 1
  205.     AddListItem DRIVETEXT$, ""
  206.     AddListItem REQUIREDTEXT$, ""
  207.   NEXT i%
  208.  
  209.  
  210.     bProdInstalled% = 0
  211.     bVfwInstalled% = 0
  212.     bNmsInstalled% = 0
  213.     
  214.   '' means the message box will allow error to be ignored if file size does not match with inf file
  215.   i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  216.  
  217.  
  218. WELCOME:
  219.   sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", PRODHELP, HELPPROC$)
  220.   IF sz$ = "CONTINUE" THEN
  221.      UIPop 1
  222.   ELSE
  223.      GOSUB ASKQUIT
  224.      GOTO WELCOME
  225.   END IF
  226.  
  227.     i% = MeetsMinRequired()
  228.     If i% = 0 Then
  229.  
  230. MINREQUIRED:
  231.   sz$ = UIStartDlg(CUIDLL$, MINREQUIRED, "FMinReqDlgProc", PRODHELP, HELPPROC$)
  232.   IF sz$ = "CONTINUE" THEN
  233.     UIPop 1
  234.   ELSE
  235.     GOSUB ASKQUIT
  236.     GOTO MINREQUIRED
  237.   END IF
  238.     End If
  239.  
  240.   '' see if the product has been installed before
  241.   szDir$ = GetIniKeyString("WIN.INI", "CRC96", "PATH")
  242.   IF szDir$ <> "" THEN
  243.     DEST$ = MID$(szDir$,1,LEN(szDir$)-1)
  244.     CheckForPROD(szDir$)
  245.   ELSE
  246.     '' no entry in win.ini should we look for other versions
  247.     '' I say no!
  248.   END IF
  249.  
  250.     '' Check for presence of Video for Windows
  251.     szVFW$ = IsDriverInstalled("MSVIDEO.DLL")
  252.     Select Case szVFW$
  253.         Case "NOT FOUND"
  254.             '' Set Windows drive and Windows directory as default for VFW
  255.             szVFW$ = RemoveSlash(WinDir$)
  256.         Case "NEWER"
  257.             bVfwInstalled% = 1
  258.             ReplaceListItem CHECKSTATES$, VID, ""
  259.             ReplaceListItem INSTALLTEXT$, VID, "(Already Installed)"
  260.         Case "NOTNEWER"
  261.             bVfwInstalled% = 1
  262.             ReplaceListItem INSTALLTEXT$, VID, "(Already Installed)"
  263.     End Select
  264.  
  265.  
  266. CUSTINST:
  267.   '' destination path
  268.   ''Truncate display if too long.
  269.   IF LEN(DEST$) > DISPLAYPATHLEN THEN
  270.         ReplaceListItem DRIVETEXT$, 7, TruncateToLengthOrLess(DEST$, DISPLAYPATHLEN)
  271.   ELSE
  272.         ReplaceListItem DRIVETEXT$, 7, DEST$
  273.   END IF
  274.   Recal